package com.hechao.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hechao.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserDao extends BaseMapper<User> {
    @Select("select * from superstar")
    List<User> selectAll();

    @Select("select * from superstar where id=#{id}")
    User selectById(Integer id);

    @Select("select *from superstar where username=#{username} and password=#{password}")
    User selectByUsernameAndPwd(String username,String password);

    @Delete("delete from superstar where id=#{id}")
    Boolean deleteById(Integer id);

    @Update("UPDATE superstar set username = #{username},password = #{password},email = #{email} where id=#{id}")
    Boolean update(User user);

    @Insert("insert into superstar(username, password,email) VALUES (#{username},#{password},#{email})")
    int insert(User user);
}
